package com.zl.demo.config;

import android.content.Context;

import com.tencent.mmkv.MMKV;

public class AppConfig {
    public static void init(Context mContext) {
        String rootDir = MMKV.initialize(mContext);
        System.out.println("mmkv root: " + rootDir);
    }


    public static MMKV getAppConfig() {
        return InnerAppMMKVConfig.APP_CONFIG_INFO;
    }

    public static class InnerAppMMKVConfig {
        private static MMKV APP_CONFIG_INFO = MMKV.mmkvWithID("AppConfigInfo", MMKV.MULTI_PROCESS_MODE);
    }

    public static String getServiceMacAddress() {
        return getAppConfig().decodeString("app_service_mac_address");
    }

    public static void setServiceMacAddress(String address) {
        getAppConfig().encode("app_service_mac_address", address);
    }

    public static String getLastSendMsg() {
        return getAppConfig().decodeString("app_last_send_msg");
    }

    public static void setLastSendMsg(String msg) {
        getAppConfig().encode("app_last_send_msg", msg);
    }

}
